import Vue from 'vue'
import VueRouter from 'vue-router'
// import Home from '../views/Home.vue'
import Layout from '../views/layout/index'
import Rage from '../views/rage/index'
import songList from '../views/songList/index'
import leaderBoard from '../views/leaderBoard/index'
import hotSinger from '../views/hotSinger/index'
import playListDetail from '../views/playListDetail/index'
import playDetail from '../views/playerDetail/index'
// import ss from '../views/ss/idnex'
const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

Vue.use(VueRouter)

const routes = [
  {
    path: '/index',
    component: Layout,
    children: [
      { path: 'rage', name: 'rage', component: Rage },
      { path: 'songList', name: 'songList', component: songList },
      { path: 'leaderBoard', name: 'leaderBoard', component: leaderBoard },
      { path: 'hotSinger', name: 'hotSinger', component: hotSinger }
    ]
  },
  {
    path: '/playListDetail/:id',
    name: 'playListDetail',
    component: playListDetail
  },
  {
    path: '/playerDetail/:id',
    name: 'playerDetail',
    component: playDetail
  },
  {
    path: '*',
    redirect: '/index/rage'
  }
]

const router = new VueRouter({
  routes
})

export default router
